Sophie Au

Software Developer, Web Designer, Tea Enthusiast

Go Resources

28 June 2021

Documentation etc.:

  • The official Sites: golang.org and go.dev plus pkg.go.dev for package documentation
  • Go by Example: Documentation through examples. In my opinion much better than the official docs, even if it doesn't cover everything.
  • Awesome Go: If you're looking for a Go tool, chances are you'll find it on this list.
  • Golang Code: Go snippets fot what feels like every usecase you can think of.

Language Annoyance Fixes (includes mini-rants, sorry):

  • Test Assertions: Testify. You can say what you want about "language purity" and how "the test package is more than enough", testify is just the most comfortable way to write tests. And I'd rather use a popular, well-tested 3rd party tool than my own homebrew test helpers.
  • Linting: golangci-lint. The built-in golang linter is... let's call it "not my cup of tea". And not being able to turn off rules I don't agree with makes it a huge annoyance to use in my personal projects. What might work for Google is just overkill for my 5000 line side projects.
  • Dependency Management: Athens. Dependency management in Go is a mess. That's a hill I'm very happy to die on. Centralized management pre-go mod was a mess and while modules fix some of the issues it also introduces a new one: Namely that your dependencies aren't saved on your machine but are fetched from the package server/your cache all the time. Which is a huge hassle when you work offline or have a slow/expensive internet connection. Athens is a workaround that will spin up a server that stores your dependencies locally.

Tools I Use all the Time

  • GUI Development: Wails. Wails is like Electron but without a whole Chromium instance (instead running on the OS' local web rendering engines)
  • Converting JSON to Go Interfaces: JSON-to-Go. Pretty much every API uses JSON to send data around and hand-typing the corresponding Go interface is a huge hassle.
  • Creating Fake Data for Testing: Gofakeit. What it says on the tin.

Commands I Use all the Time/Find Useful/Forget Frequently

  • The Obvious Ones: go run ., go build and go test ./... for running, building and testing respectively
  • Module Commands:

    • go mod init to initialize the current folder as a module
    • go install path/to/dep to install and/or update a dependency
    • go mod tidy to remove unused dependencies